Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/withdrawal: Allow deletion of withdrawal records #582

Merged
merged 7 commits into from
Dec 12, 2023

Conversation

sashko9807
Copy link
Member

When withdrawal record is deleted decrement blockedAmount of the vault, with the amount of the withdrawal

Closes: Reported in discord

When withdrawal record is deleted decrement blockedAmount of the vault, with the amount of the withdrawal
Copy link

github-actions bot commented Dec 10, 2023

✅ Tests will run for this PR. Once they succeed it can be merged.

In case withdrawal record with status === succeeded has been deleted, vault's amount will be incremented by the withdrawal amount.
For any other status blockedAmount field will be decremented
where: { id: withdrawal.sourceVaultId },
data: {
amount: {
increment: withdrawal.status === WithdrawStatus.succeeded ? withdrawal.amount : 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have this status condition in the unit test?
Does this fluctuate?

.catch(() => {
throw new BadRequestException("Withdrawal record couldn't be deleted")
})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to check the status before updating, instead of incrementing with 0...

Don't decrement blockedAmount if withdrawal status is cancelled or declined
Added test cases for deletion of withdrawal records with status cancelled,declined
Copy link
Contributor

@slavcho slavcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand now...

@slavcho slavcho added the run tests Allows running the tests workflows for forked repos label Dec 12, 2023
@github-actions github-actions bot removed the run tests Allows running the tests workflows for forked repos label Dec 12, 2023
@slavcho slavcho added the run tests Allows running the tests workflows for forked repos label Dec 12, 2023
@github-actions github-actions bot removed the run tests Allows running the tests workflows for forked repos label Dec 12, 2023
@slavcho slavcho merged commit 917833f into podkrepi-bg:master Dec 12, 2023
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants